apply For Seat
abstract fun applyForSeat(seatIndex: Int, timeout: Int, extraInfo: String?, completion: CompletionHandler?)
Apply to go on seat
Request to join co-guest session as an audience member.
After calling this method, a co-guest request is sent to all hosts in the live room. The request will remain active until:
Host accepts via acceptApplication
Host rejects via rejectApplication
Timeout expires
You cancel via cancelApplication
Important: This method only confirms the request was successfully sent. Listen to GuestListener to know when host responds to your application.
Tip: If no host responds within the timeout, GuestListener.onGuestApplicationNoResponse event with NoResponseReason.TIMEOUT will be triggered.
Example
// Apply for auto-assigned seat with 30 second timeout
store.applyForSeat(
seatIndex = -1,
timeout = 30,
extraInfo = "{\"level\": \"VIP\"}",
completion = { code, message ->
if (code == 0) {
println("Application sent successfully")
} else {
println("Failed to send application: $message")
}
}
)
// Add guest event listener
store.addGuestListener(object : GuestListener() {
override fun onGuestApplicationResponded(isAccept: Boolean, hostUser: LiveUserInfo) {
if (isAccept) {
println("Application accepted by ${hostUser.userName}!")
} else {
println("Application rejected by ${hostUser.userName}")
}
}
override fun onGuestApplicationNoResponse(reason: NoResponseReason) {
println("No response: $reason")
}
})Content copied to clipboard
Parameters
seat Index
Seat index, -1 means auto-assign seat
timeout
Timeout (unit: seconds)
extra Info
Extra information
completion
Completion callback